import { axiosInstance } from "..";

//待處置清單條數
function GetDept(org_code: string) {
  return new Promise((resolve, reject) => {
    axiosInstance()
      .post("/hrsystem/measureoperate/getdeptbyorg", { org_code })
      .then(
        (res: any) => {
          resolve(res);
        },
        (err: any) => {
          reject(err);
        }
      );
  });
}

function GetQeuryList(param: string) {
  return new Promise((resolve, reject) => {
    axiosInstance()
      .post("/improveAchievement/home/getquerylist", { param })
      .then(
        (res: any) => {
          resolve(res);
        },
        (err: any) => {
          reject(err);
        }
      );
  });
}

function GetFlow(docid: string) {
  return new Promise((resolve, reject) => {
    axiosInstance()
      .post("/improveAchievement/home/getflow", { docid })
      .then(
        (res: any) => {
          resolve(res);
        },
        (err: any) => {
          reject(err);
        }
      );
  });
}

function GetSignImg(docid: string) {
  return new Promise((resolve, reject) => {
    axiosInstance()
      .post("/improveAchievement/home/getsignimg", { docid })
      .then(
        (res: any) => {
          resolve(res);
        },
        (err: any) => {
          reject(err);
        }
      );
  });
}

function DownloadImg(filename: string) {
  return new Promise((resolve, reject) => {
    axiosInstance()
      .post("/improveAchievement/home/download", { filename })
      .then(
        (res: any) => {
          resolve(res);
        },
        (err: any) => {
          reject(err);
        }
      );
  });
}

function UpLoadAppendix(formdata:any){
  return new Promise((resolve,reject)=>{
      axiosInstance().post("/improveAchievement/home/uploadappendix",formdata).then(
          (res:any)=>{
              resolve(res)
          },
          (err:any)=>{
              reject(err)
          }
      )
  })
}

export { GetDept, GetQeuryList, GetFlow, GetSignImg, DownloadImg,UpLoadAppendix };
